1. Field of the Invention
The present invention relates to a data allocation method and device, especially to a data allocation method and device capable of executing allocation instantly and exploiting a storage space efficiently.
2. Description of Related Art
For many electronic devices, receiving and storing digital data is necessary for device operation. However, even though the technique of receiving and storing digital data develops for a long time, it still has some problems. For instance, regarding the technique of receiving and storing multiple data streams, some current art allocates a storage unit of the maximum data storage amount for storing each data of the data streams regardless of the data size, which can execute allocation rapidly but can merely achieve low utilization of the storage space. Some other current art allocates a storage unit of an appropriate data storage amount for storing each data of the data streams, which can make better use of the storage space, but will lead to the fragmentation problem (i.e., the addresses of the storage space for a single piece of data are scattered while the data are segmented by different sizes) after repeated storage space allocation and release, and will lead to slow allocation instead of instant allocation gradually. Some other current art prepares a single storage unit for storing successive pieces of data of each data stream; although this can utilizing the storage space efficiently, in order to meet the requirement for the following data sort and reassembly processes in the worst case, the minimum size of the said single storage unit should be “the window size (i.e., the number of the pieces of data to be retained) multiplied by the expected maximum data amount of a single piece of data”. Accordingly, this art will consume a lot of storage resources; and the spare spaces for storing different data streams respectively can not be shared among the storage processes of these data streams, which will lead to the waste of storage resource.